package cn.tyz.kotlin

import android.app.Application
import android.util.Log
import cn.tyz.kotlin.net.VolleySingletion
import java.lang.System.exit

/**
 * @author : tianyingzhong
 * @ClassName: BaseApplication
 * @Description:
 * @time 2017/8/23 19:36
 */

class KotlinApp : Application(), Thread.UncaughtExceptionHandler {
    override fun uncaughtException(t: Thread?, e: Throwable?) {
        Log.e("KotlinApp","======================= name = "+t?.name)
        Log.e("KotlinApp","message = "+e?.message)
        Log.e("KotlinApp","cause = "+e?.cause)
        exit(0)
    }

    override fun onCreate() {
        super.onCreate()
        //初始化Volley配置
        Thread.setDefaultUncaughtExceptionHandler(this) //设置应用默认的全局捕获异常器
        VolleySingletion.initConfig(this)
    }
}